import 'package:dmz/base/pageWidget/base_stateful_widget.dart';
import 'package:dmz/base/widget/load_state_widget.dart';
import 'package:dmz/business/home/widgets/run_message_widgets.dart';
import 'package:dmz/tools/map/map_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';

import '../controller/map_locus_controller.dart';

class MapLocusPage extends BaseStatefulWidget<MapLocusController> {
  const MapLocusPage({super.key});

  @override
  bool showTitleBar() => false;

  @override
  bool onleyShowBackButton() => true;

  @override
  bool backColorBlack() => true;

  @override
  Widget buildContent(BuildContext context) {
    return controller.initLatLng == null
        ? createEmptyWidget(controller)
        : Stack(alignment: Alignment.bottomCenter, children: [
            EMIGDMapWidget(
              latLng: controller.initLatLng,
              initMarkerMap: controller.markerMap,
              initPolylinesMap: controller.initPolylinesMap,
              onMapCreated: (controllered) =>
                  controller.mapController = controllered,
            ),
            RunMessageWidgets.locusMapBottomWidget(
                controller.data.photo ?? '', controller.locusData)
          ]);
  }
}
